<html>
<head><meta charset="utf-8"><title>Run `x.py` slightly more conveniently! · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html">Run `x.py` slightly more conveniently!</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="216029681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216029681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Casey Rodarmor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216029681">(Nov 08 2020 at 22:54)</a>:</h4>
<p>I thought this would be of general interest as a minor quality of life improvement for compiler hackers:</p>
<p>I wrote a tiny wrapper around <code>x.py</code> that makes it slightly more convenient to call. The binary is called <code>x</code> and it can be installed globally and run from any subdirectory of a Rust compiler checkout.</p>
<p>All it does is <code>cd</code> up until it finds <code>x.py</code> and then runs that. It should run on all OSes, and it also tries to intelligently select a version of python that's available.</p>
<p>It can be installed with <code>cargo install --path src/tools/x</code>, and then run with <code>x</code> from any Rust compiler checkout.</p>



<a name="216034258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216034258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216034258">(Nov 09 2020 at 00:45)</a>:</h4>
<p>(deleted)</p>



<a name="216060572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216060572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216060572">(Nov 09 2020 at 09:35)</a>:</h4>
<p>As a bit of self-promotion, I think we <em>could</em> make <code>cargo x --stage 1 whatever</code> work inside rust-lang/rust: <a href="https://github.com/matklad/cargo-xtask">https://github.com/matklad/cargo-xtask</a></p>



<a name="216145819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216145819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216145819">(Nov 09 2020 at 21:35)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> if you want to get that working, I'd be happy to review :)</p>



<a name="216145861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216145861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216145861">(Nov 09 2020 at 21:36)</a>:</h4>
<p>the hard bit is working with submodules</p>



<a name="216145926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216145926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216145926">(Nov 09 2020 at 21:36)</a>:</h4>
<p>I think <a href="#narrow/stream/131828-t-compiler/topic/RIIR.20contributor.20entry.20point">https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/RIIR.20contributor.20entry.20point</a> is where discussion left off last time</p>



<a name="216444750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216444750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Simon Sapin <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216444750">(Nov 12 2020 at 09:25)</a>:</h4>
<p>I have the same! Though mine is much more dumb:<br>
<code>#!/bin/sh
exec ./x.py "$@"</code></p>



<a name="216456789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216456789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216456789">(Nov 12 2020 at 11:36)</a>:</h4>
<p><span class="user-mention silent" data-user-id="255845">Casey Rodarmor</span> <a href="#narrow/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!/near/216029681">said</a>:</p>
<blockquote>
<p>All it does is <code>cd</code> up until it finds <code>x.py</code> and then runs that. It should run on all OSes, and it also tries to intelligently select a version of python that's available.</p>
</blockquote>
<p>The beginning of <code>x.py</code> is </p>
<div class="codehilite" data-code-language="Bash"><pre><span></span><code><span class="ch">#!/usr/bin/env python</span>
</code></pre></div>
<p>Isn't the sheband enough?</p>



<a name="216457073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216457073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216457073">(Nov 12 2020 at 11:39)</a>:</h4>
<p>(deleted)</p>



<a name="216472491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216472491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216472491">(Nov 12 2020 at 14:10)</a>:</h4>
<p>(deleted)</p>



<a name="216472539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216472539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216472539">(Nov 12 2020 at 14:10)</a>:</h4>
<p><span class="user-mention" data-user-id="281841">@Robin Moussu</span> no <a href="https://github.com/rust-lang/rust/issues/71818">https://github.com/rust-lang/rust/issues/71818</a></p>



<a name="216473059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Run%20%60x.py%60%20slightly%20more%20conveniently%21/near/216473059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Run.20.60x.2Epy.60.20slightly.20more.20conveniently!.html#216473059">(Nov 12 2020 at 14:14)</a>:</h4>
<p>(deleted)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>